package soap;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;


/**
 * WGETJava
 * @author Adriano de Albuquerque Batista
 * @author Alfeu Buriti
 * @author Pablo Diego Alencar
 * @author Yuri Cariry Cabral de Melo
 *
 */
public class WGETJavaTeste { 

	
	public static void main(String[] args) throws IOException {
		
		String urlLinks ; 
		String outFilename;
		
		//URL url = new URL("http://ops.espacenet.com/OpenPatentServices/webService");
	
		URL url = new URL("http://www.javafree.org/topic-860767-Arquivo-txt.html");

		
		
		WGETJava wget = new WGETJava(); 
		WGETJavaResults resultado = wget.DownloadFile(url);
		
		System.out.println("resultado " + resultado);
		
	}
	

}


/*
 *	
	 *  Baixa dados da internet no linque urlLinks com o wget 
	 *  e cria um arquivo de saida chamado outFilename		
	 * @param urlLinks
	 * @param outFilename
	 *
	public void urlWgetReader(String urlLinks, String outFilename) {
		System.out.println("Inicio do UrlReader -> urlWgetReader ");	

		// Chame o wget para baixar paginas
		Runtime rt = Runtime.getRuntime();

		// String wgetCall = "wget --proxy=on
		// abatista:aab1Inpi@172.16.136.1:8080 "+urlLinks+" -O
		// C:\\\\cygwin\\\\home\\\\batista\\\\test.html";
		// String wgetCall = "./wget.sh";
		// String wgetCall = "wget --proxy=on
		// abatista:aab1Inpi@172.16.136.1:8080 "+urlLinks+" -nv -nd -";
		String wgetFile = "wget.sh";
		String wgetCall = "wget -o wget.log -O " + outFilename + " " + urlLinks;
		new PrintFile(wgetFile, wgetCall);
		// String wgetOutput = "";
		// Process proc;
		System.out.println(wgetCall);

		try {
			Process proc = rt.exec("./wget.sh");


			//VARIAVEL NUNCA LIDA ?????????????
			int rtnValue = proc.waitFor(); 
			//VARIAVEL NUNCA LIDA ?????????????
		} catch (InterruptedException e) {
			System.err.println(e);
		} catch (SecurityException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

		System.out.println("Fim do UrlReader -> urlWgetReader ");	

	}
 
 */
